import axios from 'axios'

const apiClient = axios.create({
  baseURL: 'http://localhost:8082/',
  timeout: 5000,
})

export default {
  getUsers() {
    return apiClient.get('/users')
  },
  getUserById(id) {
    return apiClient.get(`/users/${id}`)
  },
  //保存
  saveUser(user) {
    return apiClient.post('/users', user)
  },
  updateUser(id, user) {
    return apiClient.put(`/users/${id}`, user)
  },
  delectUserById(id){
    return apiClient.delete(`/users/${id}`)
  }
}